package com.sinog.core.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 文件路径白名单检查
 */
public class SecurityWhiteList {
    /**
     * 路径合法资源池
     */
    private static Pattern pattern = Pattern.compile("正则表达式相关的");

    /**
     * 检查文件的输入路径是否合法
     * @param input
     * @return
     */
    public static String checkPath(String input) throws Exception {
        Matcher matcher = pattern.matcher(input);
        boolean check = matcher.matches();
        if (!check) {
            throw new Exception("路径不合法");
        }
        return input;
    }


}
